UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sw0bfcbpTHeGBY/b03sAw9OGwduwDSeGaFQMb6wCctc=' 
WHERE 
  key_id = '87ed9da33a0d114702536c14cfdd772f8cf91a020269a5c19ab6d1506851049e' 
  AND (
    token = 'Sw0bfcbpTHeGBY/b03sAw9OGwduwDSeGaFQMb6wCctc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042