UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tqggWtJLubqD2BKTSHulAk9u3uPOIj0p1Jf5g4S1FX4=' 
WHERE 
  key_id = '05d710a50c7531f19157fe1b60870d900dff43c1dcfdc1bf745dba32654a0cb2' 
  AND (
    token = 'tqggWtJLubqD2BKTSHulAk9u3uPOIj0p1Jf5g4S1FX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038