UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WvNzsMCG4Qc2nHF4TH6k530xkfe/PZqCOK+3iHXmSnM=' 
WHERE 
  key_id = '28c96e744edb862a776148acd485dfab97a712511a26f4d14966e6457648145d' 
  AND (
    token = 'WvNzsMCG4Qc2nHF4TH6k530xkfe/PZqCOK+3iHXmSnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046