UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q7w2Ysu4YyuuFjgjt5yxYmab7Muh2v5bdecHFDjC4Sc=' 
WHERE 
  key_id = '90e90f750429607080002f78ac2688607aba978474b89b4ead158222b5e89d0e' 
  AND (
    token = 'Q7w2Ysu4YyuuFjgjt5yxYmab7Muh2v5bdecHFDjC4Sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030