UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FouAIwvPZj4k3euhV5UU21JH/AHQBms2DXhsWtAXVAA=' 
WHERE 
  key_id = 'af3662b27df8d8641324bcb19dba2900e745d683750d321f84eb1db5716f9503' 
  AND (
    token = 'FouAIwvPZj4k3euhV5UU21JH/AHQBms2DXhsWtAXVAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026