UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VA9ulXS0pI5ntdBTIpopW34UPXlQWaOHm30N6fTVWEg=' 
WHERE 
  key_id = '21e52db88095c2f63b3034dbd1c72f9162e3eab9054b3d7595ea0c5214aa5f5f' 
  AND (
    token = 'VA9ulXS0pI5ntdBTIpopW34UPXlQWaOHm30N6fTVWEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024