UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ChYYNkzVLFXL/I7WijUoJMpjQadRq03erlQkzgDbdhM=' 
WHERE 
  key_id = '438b39991d7b9e5014c312d02ad15ee5c0475d745399f912cf38d0dc34e4fd43' 
  AND (
    token = 'ChYYNkzVLFXL/I7WijUoJMpjQadRq03erlQkzgDbdhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060