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

Query time 0.00039