UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TrfvyUQhs5QFxBEgof9DI3JOJY3jw+JLLPhlII44Vwc=' 
WHERE 
  key_id = '147615d6a86195f50e2f437524d883be272b8cea9742ad6bb61db4f31a9ec3a1' 
  AND (
    token = 'TrfvyUQhs5QFxBEgof9DI3JOJY3jw+JLLPhlII44Vwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032