UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iIMptqI4xrcIiHCd4gW38+gGEAd96471xlrJ3eX2Pco=' 
WHERE 
  key_id = '371d5cc7e148b0e42803538daa91b60edeff316805c3989476184a1e656cdf2a' 
  AND (
    token = 'iIMptqI4xrcIiHCd4gW38+gGEAd96471xlrJ3eX2Pco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039