UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SHsqdgvFDGRbJhg0SgN4xH3d1w40pc69GPoSxLR40M4=' 
WHERE 
  key_id = '17dbf05da261566ec40ba044e471ab3a27d9e3de5a94a3c5f0bff88be19c96da' 
  AND (
    token = 'SHsqdgvFDGRbJhg0SgN4xH3d1w40pc69GPoSxLR40M4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026