UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WbKYSNlK3pTVXm5Dh+stycd1F96+zepFS71sKwMHF98=' 
WHERE 
  key_id = '7a741684c3f7a393a243df945ee2be807c7af1bb78ac0d8d98d7818873ce013a' 
  AND (
    token = 'WbKYSNlK3pTVXm5Dh+stycd1F96+zepFS71sKwMHF98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079