UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a/eMYx7uY46+e28XmlC9SilwwpjkB/NZCDV1rnAgfRg=' 
WHERE 
  key_id = '53b790aa31dc4239c85ab1142893017f6a8f6f033367d79e2bfed85ee75798c8' 
  AND (
    token = 'a/eMYx7uY46+e28XmlC9SilwwpjkB/NZCDV1rnAgfRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029