UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'crGq54igmMTxbWPImcAtyxT7Kl/f1eD1tSO3HaRYyAg=' 
WHERE 
  key_id = '46f5cc3bdf8f47e917269cce80e09dadd8e3d9f12d068bed9cb361434a1a871d' 
  AND (
    token = 'crGq54igmMTxbWPImcAtyxT7Kl/f1eD1tSO3HaRYyAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039