UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i41sJLlQ9ine7+/P2GVsQESzQTDZP5oUM5GhZteB250=' 
WHERE 
  key_id = 'd18142479d946d0a0e1c9aba7eba31096f3294a3351b5a22c1cf0c22c015455a' 
  AND (
    token = 'i41sJLlQ9ine7+/P2GVsQESzQTDZP5oUM5GhZteB250=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038