UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qx0NlhtLT1sRx6gdHdDXSRDuPnHBdyFRbsk3ToEIdBM=' 
WHERE 
  key_id = 'ec52800c5aaadf92f8c2ac573c4b5c2eb9b9d49b22e3d47e458e1b16e943f4b1' 
  AND (
    token = 'qx0NlhtLT1sRx6gdHdDXSRDuPnHBdyFRbsk3ToEIdBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039