UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2ckUprBE5i+LGDAJlwWqInuFkOaR2vsr+dGx7VwQzE=' 
WHERE 
  key_id = 'a40561ef850960cab272c9c7984816a6fe297714e729a6dd23167b4e3f0f9a23' 
  AND (
    token = 'E2ckUprBE5i+LGDAJlwWqInuFkOaR2vsr+dGx7VwQzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035