UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yS6FbcxD5NoDcjOFB4nCG3CWRuidw+FdAeEZcClblAQ=' 
WHERE 
  key_id = '59f4c1ecc3c91c15a6479e0ded10f72cc7b5bd78e21c554b7657c7c0715b4a7f' 
  AND (
    token = 'yS6FbcxD5NoDcjOFB4nCG3CWRuidw+FdAeEZcClblAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027