UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ozh16WcGby7N0Z3V62T+dU1LRhVrOm1N4iN0e//1qjA=' 
WHERE 
  key_id = 'e6c4796401d90195a0072be679dae0e0977269e213e399f17ff2989ce93bbe3f' 
  AND (
    token = 'ozh16WcGby7N0Z3V62T+dU1LRhVrOm1N4iN0e//1qjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047