UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p4RL84Zc24xXzrFlksQsIl2stVPr5sz4RqBccqswG0o=' 
WHERE 
  key_id = '40ff1179d0c90dc1520bb22ac16e16eedbab16704873f2e5144afba7014f02c3' 
  AND (
    token = 'p4RL84Zc24xXzrFlksQsIl2stVPr5sz4RqBccqswG0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025