UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0aP+3iVpW+LROwjJg+Lxe05cmdPwvW5U4RO5x32aabc=' 
WHERE 
  key_id = '2b2e52e4e954795fc71d3061559022a457b4d7f882efc718243fa4d2a480fdb0' 
  AND (
    token = '0aP+3iVpW+LROwjJg+Lxe05cmdPwvW5U4RO5x32aabc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029