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

Query time 0.00044