UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8nFxTvbdtOR4BKssqaqLW3WbL+y9LGDOmZ0XG953YvM=' 
WHERE 
  key_id = 'a4b9c798950e28212a66f6feaace8f24fd52791e35053e8f4c9e8d5bf8f33bdd' 
  AND (
    token = '8nFxTvbdtOR4BKssqaqLW3WbL+y9LGDOmZ0XG953YvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037