UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGdT1VxmfwnDIjswPNXwWAMxUGC8d7R6PZvVUVC+EtM=' 
WHERE 
  key_id = 'f1137b026b77b2ce34887e056eb6951dde728a776c59fd854c2e67ff967e738f' 
  AND (
    token = 'WGdT1VxmfwnDIjswPNXwWAMxUGC8d7R6PZvVUVC+EtM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035