UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A9VZUYzv89TrEbKQOfwIyHwz+2tUSDVLqLzDCh+OdcA=' 
WHERE 
  key_id = 'd29c1837270ed67e9b7a48d3949c0213d4ee4e82fab2af204cb9c7c83cd5ce50' 
  AND (
    token = 'A9VZUYzv89TrEbKQOfwIyHwz+2tUSDVLqLzDCh+OdcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024