UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i6WdVM1OWg8doh49vvXLThHU6wUh/+luGqoF5+hNDhU=' 
WHERE 
  key_id = 'd7c10fa0f1a7009ae0157c37474c2ab0a51f0681937a9df4e9f4689f0b626b27' 
  AND (
    token = 'i6WdVM1OWg8doh49vvXLThHU6wUh/+luGqoF5+hNDhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040