UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '12FnpkqXVx2sUps7UBrX4HBAQihUWW90feeWcJaSUEw=' 
WHERE 
  key_id = '8fa1606ccd28f6cd205f5896ffa1c5df1c111a0435c42a4b63fe45c99be645bf' 
  AND (
    token = '12FnpkqXVx2sUps7UBrX4HBAQihUWW90feeWcJaSUEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017