UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jevwU6bGk+Sut9Aie7IdAqUudF5PWbg2WTlm98Uurds=' 
WHERE 
  key_id = 'c49168320d0e81be7dd06965ee84879100665ed231e28ee54dc2ae2a9db31b6f' 
  AND (
    token = 'jevwU6bGk+Sut9Aie7IdAqUudF5PWbg2WTlm98Uurds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038