UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Opa9T8jOFqVNSPcANHU7OfaxEE/rREarafBnJxWSNyY=' 
WHERE 
  key_id = '1c9d7660889a13b65c7e5661294b9ff892dfa0ad16341b9e5709b806bd09aa01' 
  AND (
    token = 'Opa9T8jOFqVNSPcANHU7OfaxEE/rREarafBnJxWSNyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023