UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Te55W283OwVRAyL1Mzf7g5OpcsmBmodruTZnMetyrg=' 
WHERE 
  key_id = '06fd4c1dcdf009898492bdf1e9187cf78fa6ea444f69a1292b8772544a6282ff' 
  AND (
    token = '8Te55W283OwVRAyL1Mzf7g5OpcsmBmodruTZnMetyrg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023