UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YNGm4C69uKqafJpRRmPHM1JsT+sb7QVjyBdkRZJwJms=' 
WHERE 
  key_id = 'c08afcfe761a729059cdcb966a76868b07c257d88d6e686b1cdd866affa496b7' 
  AND (
    token = 'YNGm4C69uKqafJpRRmPHM1JsT+sb7QVjyBdkRZJwJms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056