UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vWw43TZ0YmCoqSo4iB08KjkfhUOI9IWkR3bdc/IDOfo=' 
WHERE 
  key_id = 'ea87ade50c27e66b396e8abca537308b3fc38c0e92b407b92521782ffea4168f' 
  AND (
    token = 'vWw43TZ0YmCoqSo4iB08KjkfhUOI9IWkR3bdc/IDOfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025