UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FUvEft/DJzGfyFOHkghRtgaWW5GgTFyp0yyaI1SQjOs=' 
WHERE 
  key_id = 'a1e1fd5bf23e41126679d097e5ced39d9e86ba7af57e9bf6da55e719753a3ba9' 
  AND (
    token = 'FUvEft/DJzGfyFOHkghRtgaWW5GgTFyp0yyaI1SQjOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015