UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N8vjlwAPttP4ofEVcT2O734JKWURIhXUlVZNqd2V7ks=' 
WHERE 
  key_id = 'd9fc950b67f473928f03becb7e7619809e8cc47ff393d5ade83b4d0a9ede9f5a' 
  AND (
    token = 'N8vjlwAPttP4ofEVcT2O734JKWURIhXUlVZNqd2V7ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020