UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7733A/A62wjnqVKBgFSuQ9nOAMM78/Qh/xbSfZAg6Sw=' 
WHERE 
  key_id = 'd05925903444151762f76b58eb87f2856186b2d7bedf00c72adabd83c26a9790' 
  AND (
    token = '7733A/A62wjnqVKBgFSuQ9nOAMM78/Qh/xbSfZAg6Sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036