UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rYIdcD7f/xTNe+TNoW8OJsyG+TOfEOyF7gmAmcHW0Hs=' 
WHERE 
  key_id = '942f5864aaeb16e3cd8a3107f2fb39917c2ff5790d9675f682a7166fd5c0b625' 
  AND (
    token = 'rYIdcD7f/xTNe+TNoW8OJsyG+TOfEOyF7gmAmcHW0Hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025