UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qGPjsJV2KriQZgGtU/r3gKdZxG/+RmYGhrPIWru5F64=' 
WHERE 
  key_id = '9ef79b0ae821a1dfebd098e24d018758e84ff0d267810e4726948abe4cfba766' 
  AND (
    token = 'qGPjsJV2KriQZgGtU/r3gKdZxG/+RmYGhrPIWru5F64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050